package com.example.leon.demo.Activity;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.example.leon.demo.R;
import com.example.leon.demo.common.BaseActivity;

/**
 * Created by wang.long on 2016/3/28.
 */
public class UIWidgetTest extends BaseActivity implements View.OnClickListener {

    private  Button btn1;
    private TextView txt1;
    private EditText et1;
    private ImageView imageView;
    private ProgressBar progressBar;

    @Override
    protected void onCreate(Bundle saveInstanceState){
        super.onCreate(saveInstanceState);
        super.setContentView(R.layout.uiwidgettest_layout);

        txt1=(TextView) findViewById(R.id.text_view);
        btn1=(Button) findViewById(R.id.btnchangetext);
        et1=(EditText) findViewById(R.id.et1);
        imageView=(ImageView) findViewById(R.id.imageview1);
        progressBar=(ProgressBar) findViewById(R.id.progressBar);

        btn1.setOnClickListener(this);



    }

    @Override
    public void onClick(View v){
        switch (v.getId()){
            case R.id.btnchangetext:
//                txt1.setText("change");
//                String inputText=et1.getText().toString();
//                Toast.makeText(UIWidgetTest.this, inputText, Toast.LENGTH_SHORT).show();
//                imageView.setImageResource(R.drawable.b);
//                if(progressBar.getVisibility()==View.GONE){
//                    progressBar.setVisibility(View.VISIBLE);
//
//                } else {
//                    progressBar.setVisibility(View.GONE);
//                }
//                AlertDialog.Builder dialog=new AlertDialog.Builder(UIWidgetTest.this);
//                dialog.setTitle("this is dialog");
//                dialog.setMessage("something important");
//                dialog.setCancelable(false);
//                dialog.setPositiveButton("ok", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//
//                    }
//                });
//                dialog.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//
//                    }
//                });
//                dialog.show();

                ProgressDialog progess=new ProgressDialog(UIWidgetTest.this);
                progess.setTitle("THIS IS PROGRESS");
                progess.setMessage("loading...");
                progess.setCancelable(true);
                progess.show();
                break;
            default:
                break;

        }


    }



}
